<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        .inner{
            height: 150px;
            background-color: darkcyan;
        }
    </style>
</head>
<body>
    <!-- stop 可以阻止事件冒泡-->
    <!-- <div id="app">
        <div class="inner" @click="divHandler">
            <input type="button" value="戳他" @click.stop="btnHandler">
        </div>
    </div> -->

    <!--使用.prevent阻止默认行为-->
    <!-- <div id="app">
        <a href="http://www.baidu.com"  @click.prevent="linkClick">不懂查百度</a>
    </div>  -->


    <!--capture 捕获事件-->
    <!-- <div id="app">
            <div class="inner" @click.capture="divHandler">
                <input type="button" value="戳他" @click.stop="btnHandler">
            </div>
    </div> -->

    <div id="app">
        <div class="inner" @click.self="divHandler">
            <input type="button" value="戳他" @click="btnHandler">
        </div>
    </div>


    <script>
        var vm = new Vue({
            el:"#app",
            data:{
            },
            methods: {
                divHandler(){
                    console.log('这是触发了 inner div 的点击事件');
                    
                },
                btnHandler(){
                    console.log('这是触发了 input 的点击事件');
                },
                linkClick(){
                    console.log('这是触发了 a标签 的点击事件');
                }
            },
        })
    </script>
</body>
</html>